<template>
  <div>
      <el-card class="mb">
          <el-input placeholder="请输入关键词搜索"
              style="width: 200px;margin-right: 10px;">
          </el-input>
          <el-button type="primary" @click="search()" plain>查询</el-button>
          <el-button type="info" @click="research()" plain>重置</el-button>
          <el-button type="warning" style="float:right" @click="add()" plain>新增</el-button>
      </el-card>
      <el-card>
          <div class="table">
              <el-table :data="tableData" strip>
                  <el-table-column prop="" label="序号" width="70" align="center" sortable></el-table-column>
                  <el-table-column prop="" label="成果名称"></el-table-column>
                  <el-table-column prop="" label="所属分类"></el-table-column>
                  <el-table-column prop="" label="创建时间"></el-table-column>
                  <el-table-column prop="" label="成果审核状态">
                      <template slot-scope="scope">
                          <el-tag v-if="scope.row.status == '待审核'" type="danger">{{scope.row.status}}</el-tag>
                          <el-tag v-if="scope.row.status == '已通过'" type="success">{{scope.row.status}}</el-tag>
                          <el-tag v-if="scope.row.status == '未通过'" type="primary">{{scope.row.status}}</el-tag>
                          <el-tag v-if="scope.row.status == '已归档'" type="info">{{scope.row.status}}</el-tag>
                      </template>
                  </el-table-column>
                  <el-table-column label="操作" align="center" width="350">
                      <template v-slot="scope">
                          <el-button size="mini" type="danger" plain @click="del(scope.row.id)">删除</el-button>
                      </template>
                  </el-table-column>
                </el-table>

              <div class="pagination">
                  <el-pagination background @current-change="handleCurrentChange" :current-page="queryform.current"
                      :page-sizes="[5, 10, 20]" :page-size="queryform.pageSize" layout="total, prev, pager, next"
                      :total="total">
                  </el-pagination>
              </div>
          </div>

      </el-card>
      <el-dialog title="成果" :visible.sync="fromVisible" width="40%" :close-on-click-modal="false" destroy-on-close>
          <el-form :model="form" label-width="100px" style="padding-right: 50px" :rules="rules" ref="formRef">


              <el-form-item label="成果名称" prop="gname">
                  <el-input v-model="form.name" placeholder="成果名称" ></el-input>
              </el-form-item>
              <el-form-item label="所属分类" prop="gname">
                  <el-input v-model="form.name" placeholder="所属分类" ></el-input>
              </el-form-item>
              <el-form-item label="创建时间" prop="startTime">
                  <el-date-picker
                    v-model="form.starttime"
                    style="width: 100%;"
                    value-format="yyyy-MM-dd"
                    placeholder="创建时间">
                  </el-date-picker>
              </el-form-item>
              <el-form-item label="审核状态" prop="status">

                  <el-select placeholder="请选择" v-model="form.status" style="width: 100%;margin-right: 10px;">
                      <el-option  value="待审核" label="待审核"></el-option>
                      </el-select>
              </el-form-item>

          </el-form>

          <div slot="footer" class="dialog-footer">
              <el-button @click="fromVisible = false">取 消</el-button>
              <el-button type="primary" @click="save">确 定</el-button>
          </div>
      </el-dialog>

  </div>
</template>
<script>
import service from '@/utils/request';

export default {
  data() {
      return {
        fileList: [],
          teacherlist:[],
          tableData: [],  // 所有的数据
          current: 1,   // 当前的页码
          pageSize: 10,  // 每页显示的个数
          total: 0,
          username: null,
          token: "",
          name: null,
          fromVisible: false,
          avatar: "",
          queryform: {
              keyword: "",
              current: 1,
              tid: 0,
              pageSize: 10
          },
          license: "",
          form: {
              avatar: "",
              license: ""
          },
          user: {},
          rules: {
              cname: [
                  { required: true, message: '请输入名称', trigger: 'blur' },
              ],
          },
          ids: [],
          businessList: [],
          categoryList: [],
          hotellist: [],
          sjlist: [],

      }
  },
  mounted() {
      this.token = window.localStorage.getItem("token")
      this.user = JSON.parse(window.localStorage.getItem("userinfo"))
  },
  methods: {
      del(id) {
          this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
          }).then(async () => {})
            .catch(() => {
              this.$message({
                  type: 'info',
                  message: '已取消删除'
              });
          });
      },
      search() {},
      research() {},
      async getlist() {},
      add() {
          this.fromVisible = true
      },
      handleCurrentChange(e) {},
  }
}
</script>
<style scoped>
.mb {
  margin-bottom: 10px;
}
</style>
<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px !important;
  text-align: center;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
